package com.tao.clients;

import com.tao.param.PageParam;
import com.tao.param.ProductHotParam;
import com.tao.pojo.Category;
import com.tao.utils.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @author 86130
 * 类别的调用接口
 */
@FeignClient("category-service")
public interface CategoryClient {

    /**
     * 根据名称查找类别
     *
     * @param categoryName
     * @return
     */
    @GetMapping("/category/promo/{categoryName}")
    R byName(@PathVariable String categoryName);

    /**
     * 调用类别，根据类别集合查询类别id
     *
     * @param productHotParam
     * @return
     */
    @PostMapping("/category/hots")
    R hots(@RequestBody ProductHotParam productHotParam);

    /**
     * 查询类别数据进行返回
     *
     * @return
     */
    @GetMapping("/category/list")
    R list();

    /**
     * 类别分页数据查询
     * @param pageParam
     * @return
     */
    @PostMapping("/category/admin/list")
    R adminPageList(@RequestBody PageParam pageParam);

    /**
     * 类别添加
     * @param category
     * @return
     */
    @PostMapping("/category/admin/save")
    R adminSave(@RequestBody Category category);

    /**
     * 类别删除
     * @param categoryId
     * @return
     */
    @PostMapping("/category/admin/remove")
    R adminRemove(@RequestBody Integer categoryId);

    /**
     * 类别修改
     * @param category
     * @return
     */
    @PostMapping("/category/admin/update")
    R adminUpdate(@RequestBody Category category);
}
